l = ((x + 1) for x in range(5))

#print(list(l))
'''
这儿会报错：大致意思是，迭代器耗尽，在使用next时会抛出StopIteration。list(l),已经使用了迭代器。
'''
it = iter(l)
print(next(it))
print(next(it))
print(next(it))
print(next(it))
print(next(it))

# 修复上面的报错
l1 = ((x + 1) for x in range(5))
l1_list = list(l1)
print(l1_list)

l1_iter = iter(l1_list)
print(next(l1_iter))
print(next(l1_iter))
print(next(l1_iter))
print(next(l1_iter))
print(next(l1_iter))